const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');

module.exports = {
    entry: {
        index: './src/index.js',
        print: './src/print.js'
    },
    output: {
        filename: '[name].bundle.js',
        path: path.resolve(__dirname, 'dist')
    },
    module: {
        rules: [

        ]
    },
    devtool: 'inline-source-map',
    plugins: [
        new CleanWebpackPlugin(['dist']), //删除文件夹
        new HtmlWebpackPlugin({  // Also generate a test.html
            title: '我是标题',
            filename: 'index.html',
            template: './index.html',
            chunks: ['index'],  //包含
            excludeChunks: ['']  //不包含
        })
    ],
    devServer: {
        contentBase: './dist'
    }
};